package com.framework.rocketmq.component.rocketmq;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.springframework.stereotype.Component;

/**
 * 消息消费者
 */
@Component
@RocketMQMessageListener(topic = "topic-test", consumerGroup = "myConsumerGroup")
@Slf4j
public class RocketMQConsumer {

    /**
     * 消息消费方法
     *
     * @param messageExt 消息对象，包含消息的详细信息
     */
    public void onMessage(MessageExt messageExt) {
        String message = new String(messageExt.getBody());
//        log.info("Received message: " + message);
    }
}
